000100*AAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCC
000200*                      
000300*                    (SEQ)                        (SEQ)                  
000400 IDENTIFICATION              DIVISION.
000500 PROGRAM-ID.                 WRTTEST.
000600*AUTHOR.                     KENJI KIMURA.
000700 ENVIRONMENT                 DIVISION.
000800 CONFIGURATION               SECTION.
000900 INPUT-OUTPUT                SECTION.
001000 FILE-CONTROL.
001100*                        
001200*ACMFILE
001300*ACMRECNAME=O-RECORD
001400     SELECT OUT-FILE ASSIGN TO "dbtests2"
001500       ORGANIZATION LINE SEQUENTIAL.
001600 DATA                        DIVISION.
001700 FILE                        SECTION.
001800*                    
001900 FD  OUT-FILE.
002000     COPY "O_RECORD2.cbl".
002100 WORKING-STORAGE             SECTION.
002200 01  SOME-AREA.
002300     05  I-COUNTER           PIC 9(05).
002400     05  O-COUNTER           PIC 9(05).
002500     05  END-FLG             PIC 9(01)  VALUE  ZERO.
002600     05  W-COUNTER           PIC S9(05).
002700 01  WORK-AREA.
002800     05  W-A                 PIC S9(09).
002900     05  W-B                 PIC S9(09).
003000     05  W-C                 PIC S9(09).
003100     05  W-D                 PIC S9(09).
003200     05  W-EF.
003300       07  W-E               PIC 9(04).
003400       07  FILLER            PIC X(01)  VALUE  ".".
003500       07  W-F               PIC 9(03).
003600 PROCEDURE                   DIVISION.
003700*              
003800 MAIN                        SECTION.
003900     PERFORM   INIT.
004000     PERFORM   FL-OPEN.
004100     PERFORM   OUT-EDIT.
004200*                                                      
004300     PERFORM   UNTIL  END-FLG  NOT  =  ZERO
004400        PERFORM  OUT-WRITE
004500        PERFORM  OUT-EDIT
004600     END-PERFORM.
004700     PERFORM   FL-CLOSE.
004800     PERFORM   TERM.
004900     STOP RUN.
005000*              
005100 INIT                        SECTION.
005200     DISPLAY   "PROGRAM STARTING.".
005300     MOVE  -5000  TO  W-COUNTER.
005400     MOVE  0      TO  I-COUNTER.
005500*ACMTRANSACTION=TRANSACTION_READ_COMMITTED
005600*ACMAUTOCOMMIT=false
005700     EXIT.
005800*                      
005900 FL-OPEN                     SECTION.
006000     OPEN   OUTPUT  OUT-FILE.
006100     EXIT.
006200*                  
006300 OUT-EDIT                    SECTION.
006400     ADD  1              TO  I-COUNTER.
006500     ADD  1              TO  W-COUNTER.
006600*                      
006700     MOVE I-COUNTER      TO  O-ID.
006800     MOVE I-COUNTER      TO  O-CD.
006900     MOVE I-COUNTER      TO  O-NIHONGO.
007000     MOVE W-COUNTER      TO  O-SEISU.
007100     COMPUTE  W-A  =  I-COUNTER  +  12000.
007200     DIVIDE  W-A  BY  2001  GIVING  W-C
007300                         REMAINDER  O-HIZUKE-YYYY.
007400     ADD     1000        TO  O-HIZUKE-YYYY.
007500     DIVIDE  W-A  BY  12    GIVING  W-C
007600                         REMAINDER  O-HIZUKE-MM.
007700     ADD     1           TO  O-HIZUKE-MM.
007800     DIVIDE  W-A  BY  28    GIVING  W-C
007900                         REMAINDER  O-HIZUKE-DD.
008000     ADD     1           TO  O-HIZUKE-DD.
008100     DIVIDE  W-A  BY  23    GIVING  W-C
008200                         REMAINDER  O-JIKOKU-HH.
008300     ADD     1           TO  O-JIKOKU-HH.
008400     DIVIDE  W-A  BY  59    GIVING  W-C
008500                         REMAINDER  O-JIKOKU-MM.
008600     ADD     1           TO  O-JIKOKU-MM.
008700     DIVIDE  W-A  BY  59    GIVING  W-C
008800                         REMAINDER  O-JIKOKU-SS.
008900     ADD     1           TO  O-JIKOKU-SS.
009000     COMPUTE  O-FUDOU  =  W-COUNTER  /  1000.
009100     IF  I-COUNTER  >  10000
009200*                                                                
009300         MOVE  1         TO  END-FLG
009400     END-IF.
009500     EXIT.
009600*                  
009700 OUT-WRITE                   SECTION.
009800     WRITE  O-RECORD.
009900     ADD  1                  TO  O-COUNTER.
010000     IF  O-COUNTER = 1000
010100*ACMCOMMIT
010200         DISPLAY  "COMMIT." O-COUNTER
010300     END-IF.
010400     IF  O-COUNTER = 2000
010500*ACMROLLBACK
010600         DISPLAY  "ROLLBACK." O-COUNTER
010700     END-IF.
011200     IF  O-COUNTER = 3000
011300*ACMCOMMIT
011400         DISPLAY  "COMMIT." O-COUNTER
011500     END-IF.
011600     IF  O-COUNTER = 4000
011700*ACMROLLBACK
011800         DISPLAY  "ROLLBACK." O-COUNTER
011900     END-IF.
012000     IF  O-COUNTER = 5000
012100*ACMCOMMIT
012200         DISPLAY  "COMMIT." O-COUNTER
012300     END-IF.
012400     IF  O-COUNTER = 6000
012500*ACMROLLBACK
012600         DISPLAY  "ROLLBACK." O-COUNTER
012700     END-IF.
012800     IF  O-COUNTER = 7000
012900*ACMCOMMIT
013000         DISPLAY  "COMMIT." O-COUNTER
013100     END-IF.
013200     IF  O-COUNTER = 8000
013300*ACMROLLBACK
013400         DISPLAY  "ROLLBACK." O-COUNTER
013500     END-IF.
013600     IF  O-COUNTER = 9000
013700*ACMCOMMIT
013800         DISPLAY  "COMMIT." O-COUNTER
013900     END-IF.
014000     EXIT.
014100*                              
014200 FL-CLOSE                    SECTION.
014300*ACMCOMMIT.
014400     CLOSE  OUT-FILE.
014500     EXIT.
014600*              
014700 TERM                        SECTION.
014800     DISPLAY   "PROGRAM NORMALLY TERMINATED.".
014900     DISPLAY   "OUTUT-COUNT:" I-COUNTER.
015000     DISPLAY   "OUTPUT-COUNT:" O-COUNTER.
015100     EXIT.
